package com.usian.admin.controller;

import com.usian.admin.service.LoginService;
import com.usian.api.user.LoginControllerApi;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AdUserDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController implements LoginControllerApi {
    @Autowired
    private LoginService loginService;


   // @Override
    @RequestMapping("/in")
    public ResponseResult login(@RequestBody AdUserDto dto) {
        return loginService.login(dto);
    }

    @RequestMapping("/inTwo")
    public ResponseResult inTwo(@RequestBody AdUserDto adUserDto){
        return loginService.loginTwo(adUserDto);
    }
    @RequestMapping("sendCode")
    public ResponseResult sendCode(String phone) throws Exception {
        loginService.sendCode(phone);
        return ResponseResult.okResult(phone);
    }
}
